package com.notes.service.implement;

import java.util.List;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.notes.dao.UserDao;
import com.notes.model.Item;
import com.notes.model.User;
import com.notes.service.UserService;

@Service
@Transactional
public class UserServiceImplement implements UserService {
	@Autowired
	private UserDao userDao;
	
	@Override
	public Long addUser(String name, String password) {
		return userDao.addUser(name, password);
	}
	
	@Override
	public Long login(String userName, String password) {
		return userDao.login(userName,password);
		
	}
	
	@Override
	public User getUserByID(Long userId) {
		User user = userDao.getUserById(userId);
		return user;
	}

	public UserDao getUserDao() {
		return userDao;
	}

	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}

	@Override
	public List<Item> getItemByUserId(Long userId) {
		return userDao.getItemByUserId(userId);		 
	}
}
